home *** CD-ROM | disk | FTP | other *** search
/ Windows 6-Pak - Disc 4 / Windows 6-Pak (InfoMagic) (Disc 4) (1999).ISO / Text-Chat-Addins / C-Script.exe / AddOns / csboard.mrc < prev    next >
Encoding:
Text File  |  1998-05-07  |  25.3 KB  |  441 lines

  1. ;CS Whiteboard ⌐ 1998 jCd. All rights reserved.
  2.  
  3. ;Events
  4. on 1:start:unset %wh.* | wh.s in mode normal
  5. on 1:close:@:if ($target == $wh.a) { drawpic -c | window -c @custom | window -c $wh.a $+ ábanlist | sockclose server* | sockclose client | unset %wh.* | wh.s in mode normal | .timercx1 -m 1 300 window -c $wh.a | halt }
  6. ;Aliases
  7. alias wh.initiate {
  8.   if (c-script !isin $vers) || (%wpver < 5.0) { echo $colour(info) -a *** C-Script v5.0 or higher required for this addon... Get the general version at www.21stCenturyOnline.com | halt }
  9.   if ($window(-1).w < 640) || ($window(-1).h < 480) { echo $clr(info) -a *** Error starting C-Script Whiteboard: Screen resolution to small | halt }
  10.   if $1 == 1 goto end | if $1 == 2 goto end2 | if $1 == 3 goto start
  11.   .timer 1 1 window -r  $wh.a | if %wh.init == 1 { window -noa $wh.a | halt }
  12.   window -pnds +fn $wh.a 2 2 505 405 $wh.a | set %wh.init 1
  13.   :start
  14.   drawrect -f $wh.a 15 1 0 0 48 385 | set %wh.count 0 | set %wh.top 3
  15.   :next
  16.   inc %wh.count | if %wh.count > 16 goto rest
  17.   drawx 3 %wh.top 15 15 $wh.a nofill
  18.   drawrect -f $wh.a %wh.count 1 4 $calc(%wh.top + 1) 12 12
  19.   inc %wh.top 20
  20.   goto next
  21.   :rest
  22.   drawpic -c $wh.a 23 3 $adn $+ csboard.bmp | drawrect -f $wh.a 15 1 49 0 600 24
  23.   drawrect -f $wh.a 15 1 49 358 600 27 | drawrect -f $wh.a 15 1 495 24 27 350
  24.   wh.rgb | drawfill -sr $wh.a $wh.rgb($wh.s(out,bgcolor)) $getdot($wh.a,50,50) 50 50
  25.   drawx 53 3 72 18 $wh.a | drawx 130 3 72 18 $wh.a
  26.   drawx 207 3 72 18 $wh.a | drawx 284 3 72 18 $wh.a
  27.   drawx 3 363 42 14 $wh.a | drawtext $wh.a 1 arial 14 6 363 Custom
  28.   wh.top $wh.s(out,mode) | drawtext $wh.a 1 arial 14 308 5 Clear
  29.   drawx 480 3 13 18 $wh.a | drawtext -o $wh.a 1 arial 14 483 5 ?
  30.   drawline $wh.a 14 1 49 362 125 362 | drawline $wh.a 14 1 49 362 49 378
  31.   drawline $wh.a 16 1 49 378 125 378 | drawline $wh.a 16 1 125 362 125 379
  32.   drawline $wh.a 14 1 128 362 495 362 | drawline $wh.a 14 1 128 362 128 378
  33.   drawline $wh.a 16 1 128 378 495 378 | drawline $wh.a 16 1 495 362 495 379
  34.   wh.title
  35.   :end
  36.   drawx 3 326 15 15 $wh.a nofill
  37.   drawrect -fr $wh.a $wh.rgb($wh.s(out,color)) 1 4 327 12 12
  38.   drawx 3 344 15 15 $wh.a nofill
  39.   drawrect -fr $wh.a $wh.rgb($wh.s(out,bgcolor)) 1 4 345 12 12
  40.   drawtext $wh.a $wh.s(out,fg) arial 12 20 328 fg
  41.   drawtext $wh.a $wh.s(out,bg) arial 12 20 346 bg
  42.   drawline $wh.a 1 1 26 298 45 298 | drawline $wh.a 1 2 26 303 45 303
  43.   drawline $wh.a 1 3 26 308 44 308 | drawline $wh.a 1 4 27 315 44 315
  44.   drawline $wh.a 12 $wh.s(out,sz)
  45.   :end2
  46.   drawfill -rs $wh.a $wh.rgb(16) 12632256 $wh.s(out,tool)
  47.   drawrect -f $wh.a 15 1 23 211 24 40
  48.   if $1 == $null drawx 23 $calc($gettok($wh.s(out,tool),2,32) - 3) 23 22 $wh.a nofill
  49.   if $wh.s(out,type) == 7 { drawrect $wh.a $wh.s(out,nf) 1 25 213 20 5 | drawrect -f $wh.a $wh.s(out,f) 1 25 220 20 5 | drawrect -f $wh.a $wh.s(out,fb) 1 25 227 20 5 | drawrect $wh.a 1 1 25 227 20 5 }
  50. }
  51. alias -l wh.pallete {
  52.   set %wh.count 0 | set %wh.top 3
  53.   :next
  54.   inc %wh.count | if %wh.count > 16 goto end
  55.   if $inrect($1,$2,3,%wh.top,15,15) {
  56.     drawx2 3 %wh.top 15 15 $wh.a nofill
  57.     .timercx -m 1 200 drawx 3 %wh.top 15 15 $wh.a nofill
  58.     .timercx2 -m 1 300 drawrect -f $wh.a %wh.count 1 4 $calc(%wh.top + 1) 12 12
  59.     if ($wh.s(out,fg) == 12) { wh.s in color %wh.count | wh.csbar | wh.initiate 1 | halt }
  60.     else { wh.s in bgcolor %wh.count | wh.csbar | wh.initiate 1 | halt }
  61.   } | inc %wh.top 20 | goto next
  62.   :end
  63.   set %wh.count 0 | set %wh.top 3
  64.   :next2
  65.   inc %wh.count | if %wh.count > 8 goto end3
  66.   if $inrect($1,$2,23,%wh.top,23,24) {
  67.     drawx2 23 %wh.top 23 22 $wh.a nofill
  68.     .timercx -m 1 200 drawx 23 %wh.top 23 22 $wh.a nofill
  69.     drawfill -rs $wh.a 12632256 $wh.rgb(16) $wh.s(out,tool)
  70.     wh.s in tool 25 $calc(%wh.top + 3) | wh.s in type %wh.count | wh.initiate 2
  71.     goto end2
  72.   } | inc %wh.top 26 | goto next2
  73.   :end3
  74.   set %wh.count 0 | set %wh.top 53
  75.   :next3
  76.   inc %wh.count | if %wh.count > 4 goto end2
  77.   if $inrect($1,$2,%wh.top,3,72,18) {
  78.     wh.top $wh.s(out,mode) | drawx2 %wh.top 3 72 18 $wh.a
  79.     .timercx -m 1 200 drawx %wh.top 3 72 18 $wh.a nofill
  80.     if %wh.count == 1 { wh.type client | halt }
  81.     if %wh.count == 2 { wh.type normal | halt }
  82.     if %wh.count == 3 { wh.type server | halt }
  83.     if %wh.count == 4 { wh.draw drawrect -fr $wh.a $wh.rgb($wh.s(out,bgcolor)) 1 50 25 444 332 }
  84.   } | inc %wh.top 77
  85.   goto next3
  86.   :end2
  87.   if $inrect($1,$2,3,363,42,14) { drawx2 3 363 42 14 $wh.a | .timercx -m 1 200 drawx 3 363 42 14 $wh.a nofill | wh.custom }
  88.   if $inrect($1,$2,480,3,13,18) { drawx2 480 3 13 18 $wh.a | .timercx -m 1 200 drawx 480 3 13 18 $wh.a nofill | window -doa $wh.a $+ áHelp 3 3 400 300 | clear $wh.a $+ áhelp | loadbuf -p $wh.a $+ áHelp $adn $+ cshelp.txt | sline $wh.a $+ áHelp 17 }
  89.   if $inrect($1,$2,3,326,15,15) { drawx2 3 326 15 15 $wh.a nofill | wh.s in bg 1 | wh.s in fg 12 | .timercx -m 1 200 wh.initiate 1 }
  90.   if $inrect($1,$2,3,344,15,15) { drawx2 3 344 15 15 $wh.a nofill | wh.s in bg 12 | wh.s in fg 1 | .timercx -m 1 200 wh.initiate 1 }
  91.   wh.csbar
  92.   if $inrect($1,$2,23,211,24,23) || $inrect($1,$2,23,295,23,24) {
  93.     if $inrect($1,$2,25,213,20,5) { wh.s in nf 12 | wh.s in f 14 | wh.s in fb 14 }
  94.     if $inrect($1,$2,25,220,20,5) { wh.s in nf 1 | wh.s in f 12 | wh.s in fb 14 }
  95.     if $inrect($1,$2,25,227,20,5) { wh.s in nf 1 | wh.s in f 14 | wh.s in fb 12 }
  96.     if $inrect($1,$2,26,298,19,1) { wh.s in size 1 | wh.s in sz 1 26 298 45 298 }
  97.     if $inrect($1,$2,26,303,19,1) { wh.s in size 2 | wh.s in sz 2 26 303 45 303 }
  98.     if $inrect($1,$2,26,308,18,1) { wh.s in size 3 | wh.s in sz 3 26 308 44 308 }
  99.     if $inrect($1,$2,27,315,17,1) { wh.s in size 4 | wh.s in sz 4 27 315 44 315 }
  100.     wh.initiate 1
  101.   }
  102.   set %wh.p 1
  103. }
  104. alias -l wh.a return @Whiteboard
  105. alias -l wh.custom {
  106.   window -dnoap +fn @Custom 2 2 303 135 @custom
  107.   drawrect -f @custom 15 5 0 0 700 500 | drawline @Custom 14 1 5 50 262 50
  108.   drawline @Custom 14 1 5 75 262 75 | drawline @Custom 14 1 5 100 262 100
  109.   drawline @Custom 16 1 5 51 262 51 | drawline @Custom 16 1 5 76 262 76
  110.   drawline @Custom 16 1 5 101 262 101 | drawline @Custom 14 1 124 5 124 26
  111.   drawline @Custom 14 1 124 4 151 4 | drawline @Custom 16 1 124 26 151 26
  112.   drawline @Custom 16 1 151 4 151 27 | wh.csbar | window -r  @custom
  113. }
  114. alias -l wh.csbar {
  115.   if $window(@custom).state != $null {
  116.     if $wh.s(out,fg) == 12 { set %wh.bgfg color }
  117.     if $wh.s(out,bg) == 12 { set %wh.bgfg bgcolor }
  118.     set %wh.rgb $rgb($wh.rgb($wh.s(out,%wh.bgfg)))
  119.     drawrect -nf @custom 15 5 266 39 25 110 | drawrect -nf @custom 15 5 5 39 261 10
  120.     drawrect -nf @custom 15 5 5 64 261 10 | drawrect -nf @custom 15 5 5 89 261 10
  121.     drawtext -n @custom 1 arial 12 266 42 $gettok(%wh.rgb,1,44) R
  122.     drawtext -n @custom 1 arial 12 266 67 $gettok(%wh.rgb,2,44) G
  123.     drawtext -n @custom 1 arial 12 266 92 $gettok(%wh.rgb,3,44) B
  124.     drawline -n @custom 1 2 $calc($gettok(%wh.rgb,1,44) + 6) 40 $calc($gettok(%wh.rgb,1,44) + 6)  48
  125.     drawline -n @custom 1 2 $calc($gettok(%wh.rgb,2,44) + 6) 65 $calc($gettok(%wh.rgb,2,44) + 6)  73
  126.     drawline -n @custom 1 2 $calc($gettok(%wh.rgb,3,44) + 6) 90 $calc($gettok(%wh.rgb,3,44) + 6)  98
  127.     drawrect -nrf @custom $wh.rgb($wh.s(out,%wh.bgfg)) 5 125 5 25 20 | drawline @custom
  128.   }
  129. }
  130. alias -l wh.rgb {
  131.   if $1 == 1 return 0 | if $1 == 2 return 8388608 | if $1 == 3 return 32768
  132.   if $1 == 4 return 255 | if $1 == 5 return 128
  133.   if $1 == 6 return 8388736 | if $1 == 7 return 32764
  134.   if $1 == 8 return 65535 | if $1 == 9 return 65280
  135.   if $1 == 10 return 8421376 | if $1 == 11 return 16776960
  136.   if $1 == 12 return 16711680 | if $1 == 13 return 16711935
  137.   if $1 == 14 return 8421504 | if $1 == 15 return 12632256
  138.   if $1 == 16 return 16777215 | if $1 != $null return $1-
  139.   drawline $wh.a 14 1 49 358 496 358 | drawline $wh.a 14 1 495 24 495 358
  140.   drawline $wh.a 14 1 49 24 49 358 | drawline $wh.a 14 1 49 24 495 24
  141. }
  142. alias -l wh.s {
  143.   if $1 == out return $readini $adn $+ csboard.ini settings $2
  144.   if $1 == in writeini $adn $+ csboard.ini settings $2-
  145.   if $1 == rem remini $adn $+ csboard.ini settings $2-
  146. }
  147. alias -l wh.type {
  148.   if $1 isnum {
  149.     if $1 == 3 && ($wh.s(out,mode) == server || $wh.s(out,mode) == client) { return $2- }
  150.     if $wh.s(out,mode) == server {
  151.       if $1 == 4 && $sline($wh.a,0) != 0 && $sline($wh.a,1).ln != 1 { return $2- }
  152.       if $1 == 5 return $2- | if $1 == 6 && $sock(server).ip != $null { return $2- }
  153.     }
  154.     return
  155.   }
  156.   sockclose server* | sockclose client | unset %wh.*
  157.   if s isin $1 || c isin $1 {
  158.     if $1 == server {
  159.       :start
  160.       set %wh.port $$?="Enter a port number:"
  161.       if $portfree(%wh.port) && %wh.port != 80 &&  %wh.port isnum && %wh.port !isnum 6660-7000 && %wh.port != 21 && %wh.port != 110 { socklisten server %wh.port | wh.notice Now listening for incoming requests on %wh.port | set %wh.nick 1@ $+ $ip | set %wh.names 1@ $+ $ip $+ , }
  162.       else { wh.notice %wh.port is not available/valid... Try again | goto start }
  163.       wh.s in mode server
  164.     }
  165.     if $1 == client {
  166.       :start2
  167.       set %wh.port $$?="Enter a port number:"
  168.       if %wh.port == 80 || %wh.port !isnum || %wh.port isnum 6660-7000 || %wh.port == 21 || %wh.port == 110 { wh.notice %wh.port is not available/valid... Try again | goto start2 }
  169.       set %wh.addy $$?="Enter an address:"
  170.       wh.notice Initiating connection with %wh.addy on port %wh.port
  171.       wh.s in mode client | sockopen client $gettok(%wh.addy,1,32) %wh.port
  172.     }
  173.     window -c $wh.a | window -pndsl11 +fn $wh.a 2 2 635 405 $wh.a comic sans ms 12 | wh.initiate 3 | .timer 1 1 window -r  $wh.a
  174.   }
  175.   if $1 == normal { wh.s in mode normal | window -c $wh.a | unset %wh.* | wh.initiate | halt }
  176.   wh.names
  177. }
  178. alias -l wh.top {
  179.   if $1 == normal {
  180.     drawtext $wh.a 1 arial 14 210 5 Server Mode..
  181.     drawtext $wh.a 1 arial 14 57 5 Client Mode...
  182.     drawtext $wh.a 14 arial 14 135 5 Normal Mode
  183.     if %wh.count == 2 { beep | halt }
  184.   }
  185.   if $1 == server {
  186.     drawtext $wh.a 14 arial 14 210 5 Server Mode..
  187.     drawtext $wh.a 1 arial 14 57 5 Client Mode...
  188.     drawtext $wh.a 1 arial 14 135 5 Normal Mode
  189.     if %wh.count == 3 { beep | halt }
  190.   }
  191.   if $1 == client {
  192.     drawtext $wh.a 1 arial 14 210 5 Server Mode..
  193.     drawtext $wh.a 14 arial 14 57 5 Client Mode...
  194.     drawtext $wh.a 1 arial 14 135 5 Normal Mode
  195.     if %wh.count == 1 { beep | halt }
  196.   }
  197. }
  198. alias -l wh.title drawrect -f $wh.a 15 1 52 365 70 11 | drawtext $wh.a 1 arial 14 52 363 Mode: $wh.s(out,mode)
  199. alias -l wh.send {
  200.   if $wh.s(out,mode) == server && $sock(server*,0) > 0 sockwrite -tn server* draw $wh.code $1-
  201.   elseif $sock(client*,0) > 0 sockwrite -tn client* draw $wh.s(out,rand) $1-
  202.   $1-
  203. }
  204. alias -l wh.code {
  205.   set %wh.rand $wh.s(out,rand)
  206.   if %wh.rand != $null && draw !isin %wh.rand && wh. !isin %wh.rand { wh.s rem rand | return %wh.rand }
  207.   else return server
  208. }
  209. alias -l wh.send2 if $sock(server*,0) > 0 sockwrite -tn server* $1-
  210. alias -l wh.send3 if $sock(client*,0) > 0 sockwrite -tn client $1-
  211. alias -l wh.info wh.notice $1- | wh.send2 info $1-
  212. alias -l wh.draw if draw* iswm $1 wh.send $1-
  213. alias -l wh.notice drawrect -f $wh.a 15 1 131 365 363 11 | drawtext $wh.a 1 arial 14 132 363 $mid($1-,1,60) $+ ...
  214. ;Sends current list of users
  215. alias -l wh.names {
  216.   if $wh.s(out,mode) == client || $wh.s(out,mode) == server {
  217.     clear -l $wh.a | set %wh.count 0 | if $1- != $null { set %wh.names $1- }
  218.     :next
  219.     inc %wh.count | if $gettok(%wh.names,%wh.count,44) == $null goto end
  220.     aline -l $wh.a $mid($gettok(%wh.names,%wh.count,44),2,999) | goto next
  221.     :end
  222.   }
  223. }
  224. alias -l wh.del set %wh.names $remtok(%wh.names,$1,1,44) $+ , | wh.names | wh.send2 names %wh.names | wh.send2 quit $1 $1
  225. alias -l wh.nick {
  226.   :top
  227.   set %wh.nick $$?="Enter a new nick (max 8 chars):" | if %wh.nick == $null goto top
  228.   set %wh.nick $mid($gettok(%wh.nick,1,32),1,8) | wh.send3 nick %wh.nick | if $sock(server*,0) > 0 && $wh.nck(%wh.nick) == $null { wh.info $mid($gettok(%wh.names,1,44),3,999) is now known as %wh.nick ( $+ $ip $+ ) | set %wh.nick 1@ $+ %wh.nick | set %wh.names $reptok(%wh.names,$gettok(%wh.names,1,44),%wh.nick,1,44) $+ , | wh.send2 names %wh.names | wh.names }
  229. }
  230. alias -l wh.nck {
  231.   set %wh.count 0
  232.   :next
  233.   inc %wh.count | if $gettok(%wh.names,%wh.count,44) == $null return
  234.   if $mid($gettok(%wh.names,%wh.count,44),3,999) == $1- && %wh.count == 1 return 1
  235.   if $mid($gettok(%wh.names,%wh.count,44),2,999) == $1- return 1 | goto next
  236. }
  237. alias -l wh.kick {
  238.   if $sline($wh.a,0) == 0 || $sline($wh.a,1).ln == 1 { halt }
  239.   set %wh.reason $?="Reason:"
  240.   if %wh.reason != $null { set %wh.reason ( $+ %wh.reason $+ ) }
  241.   wh.info $sline($wh.a,1) was kicked from the server %wh.reason
  242.   sockclose server $+ $wh.getnum($sline($wh.a,1))
  243.   wh.del $wh.getnum($sline($wh.a,1)) $+ $sline($wh.a,1)
  244. }
  245. alias -l wh.bndel {
  246.   set %wh.line $sline(@whiteboardábanlist,1).ln
  247.   if %wh.line == $null halt
  248.   remini $adn $+ csboard.ini settings %wh.line
  249.   set %wh.num 0 | set %wh.num2 $readini -n $adn $+ csboard.ini settings num | set %wh.num3 %wh.num2
  250.   set %wh.count 0 | set %wh.num 0
  251.   :next
  252.   inc %wh.num | if %wh.num > %wh.num2 goto end
  253.   set %wh.read $readini -n $adn $+ csboard.ini settings %wh.num | if (%wh.read == $null) { inc %wh.count | goto next }
  254.   if %wh.count != 0 { set %wh.recno $calc(%wh.num - %wh.count) | writeini $adn $+ csboard.ini settings %wh.recno $readini -n $adn $+ csboard.ini settings %wh.num | remini $adn $+ csboard.ini settings %wh.num }
  255.   goto next
  256.   :end
  257.   writeini $adn $+ csboard.ini settings num $calc(%wh.num3 - 1) | wh.banlist
  258. }
  259. alias -l wh.getnum {
  260.   set %wh.count2 0
  261.   :next
  262.   inc %wh.count2 | if $gettok(%wh.names,%wh.count2,44) == $null return
  263.   if $mid($gettok(%wh.names,%wh.count2,44),2,999) == $1 return $mid($gettok(%wh.names,%wh.count2,44),1,1)
  264.   goto next
  265. }
  266. alias -l wh.ban {
  267.   set %wh.count 0
  268.   :next
  269.   inc %wh.count | if %wh.count > $wh.s(out,num) return
  270.   if $wh.s(out,%wh.count) iswm $1 return 1 | goto next
  271. }
  272. alias -l wh.ban2 {
  273.   set %wh.num $wh.s(out,num) | if %wh.num == $null { set %wh.num 0 }
  274.   inc %wh.num | set %wh.ban server $+ $getnum($sline($wh.a,1))
  275.   set %wh.ban $sock(%wh.ban).ip | wh.info %wh.ban has been banned from the server
  276.   wh.s in %wh.num %wh.ban | wh.s in num %wh.num
  277. }
  278. alias -l wh.banlist {
  279.   clear $wh.a $+ áBanlist | set %wh.count 0 | window -dnoal $wh.a $+ áBanlist 3 3 300 300 $wh.a $+ ábanlist comic sans ms 12 | window -r $wh.a $+ ábanlist
  280.   :next
  281.   inc %wh.count | if %wh.count > $wh.s(out,num) return
  282.   rline $wh.a $+ ábanlist %wh.count $wh.s(out,%wh.count) | goto next
  283. }
  284. alias -l wh.clone {
  285.   set %wh.count 0
  286.   :next
  287.   inc %wh.count | if $gettok(%wh.names,%wh.count,44) == $null return
  288.   set %wh.addy2 server $+ $mid($gettok(%wh.names,%wh.count,44),1,1)
  289.   if $sock(%wh.addy2).ip == $1 return 1 | goto next
  290. }
  291. ;Menus
  292. menu @custom {
  293.   mouse {
  294.     if $mouse.key == 1 && %wh.cust != $null {
  295.       set %wh.x $calc($mouse.x - 5)
  296.       if %wh.x < 0 { set %wh.x 0 }
  297.       if %wh.x > 255 { set %wh.x 255 }
  298.       if %wh.cust == 1 { set %wh.rgb %wh.x $+ , $+ $gettok(%wh.rgb,2,44) $+ , $+ $gettok(%wh.rgb,3,44) }
  299.       if %wh.cust == 2 { set %wh.rgb $gettok(%wh.rgb,1,44) $+ , $+ %wh.x $+ , $+ $gettok(%wh.rgb,3,44) }
  300.       if %wh.cust == 3 { set %wh.rgb $gettok(%wh.rgb,1,44) $+ , $+ $gettok(%wh.rgb,2,44) $+ , $+ %wh.x }
  301.       wh.s in %wh.bgfg $rgb( [ %wh.rgb ] ) | wh.csbar
  302.     }
  303.   }
  304.   sclick {
  305.     if $inrect($mouse.x,$mouse.y,$calc($gettok(%wh.rgb,1,44) + 5),40,2,8) { set %wh.cust 1 }  
  306.     if $inrect($mouse.x,$mouse.y,$calc($gettok(%wh.rgb,2,44) + 5),65,2,8) { set %wh.cust 2 }  
  307.     if $inrect($mouse.x,$mouse.y,$calc($gettok(%wh.rgb,3,44) + 5),90,2,8) { set %wh.cust 3 } 
  308.   }
  309.   dclick unset %wh.cust
  310.   drop { unset %wh.cust | wh.initiate 1 }
  311. }
  312. menu @whiteboard {
  313.   mouse {
  314.     if $mouse.key == 1 {
  315.       if %wh.p != $null halt
  316.       if $inrect($mouse.x,$mouse.y,0,0,55,385) || $inrect($mouse.x,$mouse.y,49,0,600,30) || $inrect($mouse.x,$mouse.y,49,353,600,27) || $inrect($mouse.x,$mouse.y,490,24,27,350) { halt }
  317.       if $wh.s(out,type) == 1 {
  318.         wh.draw drawline -rh $wh.a $wh.rgb($wh.s(out,color)) $wh.s(out,size) $wh.s(out,x) $wh.s(out,y) $mouse.x $mouse.y
  319.         wh.s in x $mouse.x | wh.s in y $mouse.y
  320.       }
  321.       if $wh.s(out,type) == 2 {
  322.         if $wh.s(out,x) != $null {
  323.           drawline -i $wh.a 1 $wh.s(out,size) $wh.s(out,x) $wh.s(out,y) $wh.s(out,lx) $wh.s(out,ly)
  324.           drawline -i $wh.a 1 $wh.s(out,size) $wh.s(out,x) $wh.s(out,y) $mouse.x $mouse.y
  325.           wh.s in lx $mouse.x | wh.s in ly $mouse.y
  326.         }
  327.       }
  328.       if $wh.s(out,type) == 3 { wh.draw drawdot -rh $wh.a $wh.rgb($wh.s(out,color)) $wh.s(out,size)) $mouse.x $mouse.y }
  329.       if $wh.s(out,type) == 6 {
  330.         drawrect -ie $wh.a 1 4 $wh.s(out,x) $wh.s(out,y) $calc($wh.s(out,lx) - $wh.s(out,x)) $calc($wh.s(out,ly) - $wh.s(out,y))
  331.         drawrect -ie $wh.a 1 4 $wh.s(out,x) $wh.s(out,y) $calc($mouse.x - $wh.s(out,x)) $calc($mouse.y - $wh.s(out,y))
  332.         wh.s in lx $mouse.x | wh.s in ly $mouse.y
  333.       }
  334.       if $wh.s(out,type) == 7 {
  335.         drawrect -i $wh.a 1 $calc($wh.s(out,size) + 1) $wh.s(out,x) $wh.s(out,y) $calc($wh.s(out,lx) - $wh.s(out,x)) $calc($wh.s(out,ly) - $wh.s(out,y))
  336.         drawrect -i $wh.a 1 $calc($wh.s(out,size) + 1) $wh.s(out,x) $wh.s(out,y) $calc($mouse.x - $wh.s(out,x)) $calc($mouse.y - $wh.s(out,y))
  337.         wh.s in lx $mouse.x | wh.s in ly $mouse.y
  338.       }
  339.       if $wh.s(out,type) == 8 {
  340.         wh.draw drawline -rh $wh.a [ $wh.rgb($wh.s(out,bgcolor)) ] $calc($wh.s(out,size) * 3) $wh.s(out,x) $wh.s(out,y) $mouse.x $mouse.y
  341.         wh.s in x $mouse.x | wh.s in y $mouse.y
  342.       }
  343.     }
  344.     elseif $mouse.key != 1 {
  345.       if %wh.p != $nulll { wh.s rem x | unset %wh.p | halt }
  346.       if $wh.s(out,type) == 2 && $wh.s(out,x) != $null { wh.draw drawline -r $wh.a $wh.rgb($wh.s(out,color)) $wh.s(out,size) $wh.s(out,x) $wh.s(out,y) $wh.s(out,lx) $wh.s(out,ly) | wh.s rem x }
  347.       if $wh.s(out,type) == 6 && $wh.s(out,x) != $null { wh.draw drawrect -re $wh.a $wh.rgb($wh.s(out,bgcolor)) $wh.s(out,size) $wh.s(out,x) $wh.s(out,y) $calc($wh.s(out,lx) - $wh.s(out,x)) $calc($wh.s(out,ly) - $wh.s(out,y)) | wh.s rem x }
  348.       if $wh.s(out,type) == 7 && $wh.s(out,x) != $null { 
  349.         if $wh.s(out,nf) == 12 { wh.draw drawrect -rh $wh.a $wh.rgb($wh.s(out,color)) $calc($wh.s(out,size) + 1) $wh.s(out,x) $wh.s(out,y) $calc($wh.s(out,lx) - $wh.s(out,x)) $calc($wh.s(out,ly) - $wh.s(out,y)) }
  350.         if $wh.s(out,f) == 12 { wh.draw drawrect -rhf $wh.a $wh.rgb($wh.s(out,bgcolor)) $wh.s(out,size) $wh.s(out,x) $wh.s(out,y) $calc($wh.s(out,lx) - $wh.s(out,x)) $calc($wh.s(out,ly) - $wh.s(out,y)) }
  351.         if $wh.s(out,fb) == 12 { wh.draw drawrect -rhf $wh.a $wh.rgb($wh.s(out,bgcolor)) $wh.s(out,size) $wh.s(out,x) $wh.s(out,y) $calc($wh.s(out,lx) - $wh.s(out,x)) $calc($wh.s(out,ly) - $wh.s(out,y)) | wh.draw drawrect -r $wh.a $wh.rgb($wh.s(out,color)) $wh.s(out,size) $wh.s(out,x) $wh.s(out,y) $calc($wh.s(out,lx) - $wh.s(out,x)) $calc($wh.s(out,ly) - $wh.s(out,y)) }
  352.         wh.s rem x
  353.       }
  354.     }
  355.   }
  356.   sclick {
  357.     if %wh.p != $null halt
  358.     if $inrect($mouse.x,$mouse.y,49,353,600,27) || $inrect($mouse.x,$mouse.y,490,24,27,350) { halt }
  359.     if $inrect($mouse.x,$mouse.y,0,0,55,385) || $inrect($mouse.x,$mouse.y,49,0,600,30) { wh.pallete $mouse.x $mouse.y | wh.s in x 51 | wh.s in y $mouse.y | halt }
  360.     if $wh.s(out,type) == 1 {
  361.       wh.draw drawline -hr $wh.a $wh.rgb($wh.s(out,color)) $wh.s(out,size) $mouse.x $mouse.y $mouse.x $mouse.y
  362.       wh.s in x $mouse.x | wh.s in y $mouse.y
  363.     }
  364.     if $wh.s(out,type) == 2 {
  365.       wh.s in x $mouse.x | wh.s in y $mouse.y | wh.s in lx $mouse.x | wh.s in ly $mouse.y
  366.       drawline -i $wh.a 1 $wh.s(out,size) $wh.s(out,x) $wh.s(out,y) $wh.s(out,lx) $wh.s(out,ly)
  367.     }
  368.     if $wh.s(out,type) == 3 { wh.draw drawdot -rh $wh.a $wh.rgb($wh.s(out,color)) $wh.s(out,size) $mouse.x $mouse.y }
  369.     if $wh.s(out,type) == 4 { wh.draw drawtext -rcho $wh.a $wh.rgb($wh.s(out,color)) arial $calc($wh.s(out,size) * 10) $mouse.x $mouse.y $calc(495 - $mouse.x) $calc(358 - $mouse.y) $$?="Enter text here:" }
  370.     if $wh.s(out,type) == 5 { wh.draw drawfill -rs $wh.a $wh.rgb($wh.s(out,bgcolor)) $getdot($wh.a,$mouse.x,$mouse.y) $mouse.x $mouse.y | wh.rgb }
  371.     if $wh.s(out,type) == 6 {
  372.       wh.s in x $mouse.x | wh.s in y $mouse.y | wh.s in lx $mouse.x | wh.s in ly $mouse.y
  373.       drawrect -ie $wh.a 1 $wh.s(out,size) $wh.s(out,x) $wh.s(out,y) $calc($wh.s(out,lx) - $wh.s(out,x)) $calc($wh.s(out,ly) - $wh.s(out,y))
  374.     }
  375.     if $wh.s(out,type) == 7 {
  376.       wh.s in x $mouse.x | wh.s in y $mouse.y | wh.s in lx $mouse.x | wh.s in ly $mouse.y
  377.       drawrect -i $wh.a 1 $calc($wh.s(out,size) + 1) $wh.s(out,x) $wh.s(out,y) $calc($wh.s(out,lx) - $wh.s(out,x)) $calc($wh.s(out,ly) - $wh.s(out,y))
  378.     }
  379.     if $wh.s(out,type) == 8 {
  380.       wh.draw drawline -rh $wh.a $wh.rgb($wh.s(out,bgcolor)) $calc($wh.s(out,size) * 3) $mouse.x $mouse.y $mouse.x $mouse.y
  381.       wh.s in x $mouse.x | wh.s in y $mouse.y
  382.     }
  383.   }
  384.   drop {
  385.     if %wh.p != $null halt
  386.     if $wh.s(out,type) == 2 {
  387.       drawline -i $wh.a 1 $wh.s(out,size) $wh.s(out,x) $wh.s(out,y) $wh.s(out,lx) $wh.s(out,ly)
  388.       wh.draw drawline -rh $wh.a $wh.rgb($wh.s(out,color)) $wh.s(out,size) $wh.s(out,lx) $wh.s(out,ly) $wh.s(out,x) $wh.s(out,y)
  389.       wh.s rem x
  390.     }
  391.     if $wh.s(out,type) == 6 {
  392.       drawrect -ie $wh.a 1 $wh.s(out,size) $wh.s(out,x) $wh.s(out,y) $calc($wh.s(out,lx) - $wh.s(out,x)) $calc($wh.s(out,ly) - $wh.s(out,y))
  393.       wh.draw drawrect -rhe $wh.a $wh.rgb($wh.s(out,bgcolor)) $wh.s(out,size) $wh.s(out,x) $wh.s(out,y) $calc($wh.s(out,lx) - $wh.s(out,x)) $calc($wh.s(out,ly) - $wh.s(out,y))
  394.       wh.s rem x
  395.     }
  396.     if $wh.s(out,type) == 7 {
  397.       if $wh.s(out,nf) == 12 { wh.draw drawrect -rh $wh.a $wh.rgb($wh.s(out,color)) $calc($wh.s(out,size) + 1) $wh.s(out,x) $wh.s(out,y) $calc($wh.s(out,lx) - $wh.s(out,x)) $calc($wh.s(out,ly) - $wh.s(out,y)) }
  398.       if $wh.s(out,f) == 12 { wh.draw drawrect -rhf $wh.a $wh.rgb($wh.s(out,bgcolor)) $wh.s(out,size) $wh.s(out,x) $wh.s(out,y) $calc($wh.s(out,lx) - $wh.s(out,x)) $calc($wh.s(out,ly) - $wh.s(out,y)) }
  399.       if $wh.s(out,fb) == 12 { wh.draw drawrect -rhf $wh.a $wh.rgb($wh.s(out,bgcolor)) $calc($wh.s(out,size) + 1)) $wh.s(out,x) $wh.s(out,y) $calc($wh.s(out,lx) - $wh.s(out,x)) $calc($wh.s(out,ly) - $wh.s(out,y)) | wh.draw drawrect -r $wh.a $wh.rgb($wh.s(out,color)) $wh.s(out,size) $wh.s(out,x) $wh.s(out,y) $calc($wh.s(out,lx) - $wh.s(out,x)) $calc($wh.s(out,ly) - $wh.s(out,y)) }
  400.       wh.s rem x
  401.     }
  402.   }
  403.   $wh.type(4,Ban):wh.ban2
  404.   $wh.type(4,Kick...):wh.kick
  405.   $wh.type(4,Ban + Kick...):wh.ban2 | wh.kick
  406.   $wh.type(5,Banlist):wh.banlist
  407.   -
  408.   $wh.type(3,Change nick...):wh.nick
  409.   $wh.type(6,Change topic...):wh.s in topic $$?="Enter a new topic:" | titlebar $wh.a $chr(91) $+ Topic: $! $+ $chr(93) | wh.send2 topic $!
  410. }
  411. menu @whiteboardábanlist {
  412.   dclick { wh.bndel }
  413.   Delete:wh.bndel
  414. }
  415. ;Socket events
  416. on 1:sockopen:client:if $sockerr > 0 { .timer 1 3 wh.notice Connection lost... Back to normal mode | wh.type normal | return } | wh.notice Connection established... Logging on | wh.s in rand $rand(a,z) $+ $rand(A,Z) $+ $rand(0,9) $+ $rand(0,9)
  417. on 1:sockread:client {
  418.   if $sockerr > 0 { .timer 1 3 wh.notice Connection lost... Back to normal mode | wh.type normal | return }
  419.   sockread %wh.read
  420.   if $gettok(%wh.read,1,32) == info wh.notice $gettok(%wh.read,2-,32)
  421.   if $gettok(%wh.read,1,32) == topic && $gettok(%wh.read,2-,32) != $wh.s(out,topic) { wh.s in topic $gettok(%wh.read,2-,32) | titlebar $wh.a $chr(91) $+ Topic: $gettok(%wh.read,2-,32) $+ $chr(93) | wh.notice Topic changed to ' $+ $gettok(%wh.read,2-,32) $+ ' }
  422.   if $gettok(%wh.read,1,32) == names wh.names $gettok(%wh.read,2-,32)
  423.   if $gettok(%wh.read,1,32) == draw && $gettok(%wh.read,2,32) != $wh.s(out,rand) && draw* iswm $gettok(%wh.read,3,32) $gettok(%wh.read,3-,32)
  424. }
  425. on 1:sockclose:client:.timer 1 3 wh.notice Connection lost... Back to normal mode | wh.type normal
  426. on 1:socklisten:server {
  427.   if $sockerr > 0 return | if %wh.server == $null { set %wh.server 1 }
  428.   inc %wh.server | sockaccept server [ $+ [ %wh.server ] ] | wh.s rem rand | set %wh.addy server [ $+ [ %wh.server ] ]
  429.   if $wh.clone($sock(%wh.addy).ip) != $null && $sock(%wh.addy).ip != $ip { sockwrite -tn %wh.addy info No clones allowed on $ip | sockclose %wh.addy | halt }
  430.   if $wh.ban($sock(%wh.addy).ip) != $null { sockwrite -tn %wh.addy info Your address is banned from $ip | sockclose %wh.addy | halt }
  431.   sockmark %wh.addy %wh.server $+ $sock(%wh.addy).ip | set %wh.names %wh.names $+ %wh.server $+ $sock(%wh.addy).ip $+ , | wh.send2 topic $wh.s(out,topic) | wh.send2 names %wh.names | wh.names
  432.   wh.info $mid($sock(%wh.addy).mark,2,999) ( $+ $sock(%wh.addy).ip $+ ) has joined
  433. }
  434. on 1:sockread:server* {
  435.   if $sockerr > 0 { .timer 1 3 wh.del $sock($sockname).mark | wh.info Connection lost from $mid($sock($sockname).mark,2,999) ( $+ $sock($sockname).ip $+ ) | return }
  436.   sockread %wh.read
  437.   if $gettok(%wh.read,1,32) == nick && $wh.nck($mid($gettok(%wh.read,2,32),1,8)) == $null { set %wh.old $sock($sockname).mark | sockmark $sockname $right($sockname,1) $+ $mid($gettok(%wh.read,2,32),1,8) | set %wh.names %wh.names $+ $sock($sockname).mark $+ , | wh.del %wh.old | wh.info $mid(%wh.old,2,999) is now known as $mid($sock($sockname).mark,2,999) ( $+ $sock($sockname).ip $+ ) }
  438.   if $gettok(%wh.read,1,32) == draw { wh.s in rand $gettok(%wh.read,2,32) | wh.draw $gettok(%wh.read,3-,32) }
  439. }
  440. on 1:sockclose:server*:.timer 1 3 wh.del $sock($sockname).mark | wh.info Connection lost from $mid($sock($sockname).mark,2,999) ( $+ $sock($sockname).ip $+ )
  441.